/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fsd.semana1.aula.echo;

import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;

/**
 *
 * @author nfsa
 */
public class EchoMain {
    
    public static void echoServerMain() throws Exception
    {
        ServerSocketChannel ss = SelectorProvider.provider().openServerSocketChannel();
        ss.socket().bind(new InetSocketAddress(12345));
        
        while (true)
        {
            SocketChannel s = ss.accept();
            Thread t = new EchoThread(s);
            t.start();
        }
    }
}
